import BaiduMap from './BaiduMap'

export default {
  async install (vue, options = {}) {
    const { ak } = options
    if (!ak) {
      console.error('baidu-map: ak is required!')
      return
    }

    const $bdmap = { ak, loaded: false }

    vue.component('baidu-map', BaiduMap)
    // await loadScript(ak)
    vue.mixin({
      created: function () {
        this.$bdmap = $bdmap
      }
    })
  }
}

// export default plugin
// export const install = plugin.install
